<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../../include/laypublic.jsp" %>
<%@ include file="../../include/vueComponent.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <title>标书评审-商务标</title>
</head>
<link rel="stylesheet" href="${ctx}/resources/vue-element-lib/detail.css">
<body>
<div id="app">
    <div class="layui-tab layui-tab-brief" lay-filter="xqxx-tab-all">
        <ul class="layui-tab-title">
            <li id="tbglId" class="layui-this" lay-id="0">标书评审详情</li>
            <li id="zgysId" lay-id="1">历史审批信息</li>
        </ul>
        <div class="layui-tab-content" style="height: 100px;">
            <div class="layui-tab-item layui-show">
                <div class="container">
                    <el-form ref="formRef" label-width="180px" label-suffix="："
                             label-position="left">
                        <%--项目基础信息--%>
                        <div class="title">
                            <h3>项目基础信息</h3>
                        </div>
                        <!--表单-->
                        <el-row>
                            <x-col>
                                <el-form-item label="项目名称" >
                                    <span>{{projectInfo.proName}}</span>
                                </el-form-item>
                            </x-col>
                            <x-col position="right">
                                <el-form-item label="项目编码" >
                                    <span>{{projectInfo.proCode}}</span>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <el-row>
                            <x-col>
                                <el-form-item label="实施机构" >
                                    <span>{{projectInfo.carryOrg}}</span>
                                </el-form-item>
                            </x-col>
                            <x-col position="right">
                                <el-form-item label="申请单位" >
                                    <span>{{projectInfo.applicant}}</span>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <el-row>
                            <x-col>
                                <el-form-item label="所属公司" >
                                    <span>{{projectInfo.compName}}</span>
                                </el-form-item>
                            </x-col>
                            <x-col position="right">
                                <el-form-item label="申报人" >
                                    <span>{{projectInfo.proposer}}</span>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <el-row>
                            <x-col>
                                <el-form-item label="营销经理" >
                                    <span>{{projectInfo.staffName}}</span>
                                </el-form-item>
                            </x-col>
                            <x-col position="right">
                                <el-form-item label="回报机制" >
                                    <span>{{projectInfo.backMech}}</span>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <el-row>
                            <x-col>
                                <el-form-item label="投资截止日期" >
                                    <el-date-picker v-model="bidReview.investEndTime" style="width: 100%;" type="date"
                                                    value-format="yyyy-MM-dd" disabled
                                                    placeholder="选择日期"></el-date-picker>
                                </el-form-item>
                            </x-col>
                            <x-col position="right">
                                <el-form-item label="意向申请会议日期" >
                                    <el-date-picker v-model="bidReview.willApplyMeetTime" style="width: 100%;"
                                                    type="date" disabled
                                                    value-format="yyyy-MM-dd"
                                                    placeholder="选择日期"></el-date-picker>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <el-row>
                            <x-col>
                                <el-form-item label="建设周期" >
                                    <span>{{projectInfo.buildYears}}</span>
                                </el-form-item>
                            </x-col>
                            <x-col position="right">
                                <el-form-item label="建安工程费用" >
                                    <span>{{projectInfo.costCae}}</span>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <el-row>
                            <x-col>
                                <el-form-item label="投资总额" >
                                    <span>{{projectInfo.sumAmount}}</span>
                                </el-form-item>
                            </x-col>
                            <x-col position="right">
                                <el-form-item label="运营周期" >
                                    <span>{{projectInfo.omYears}}</span>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <el-row>
                            <x-col position="full">
                                <el-form-item label="项目简介" >
                                    <x-input v-model="projectInfo.proRemarks" type="textarea" :rows="4" name="项目简介"
                                             disabled/>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <div class="title">
                            <h3>标书明细</h3>
                        </div>
                        <el-row>
                            <x-col position="full">
                                <el-form-item label="拟任项目经理" >
                                    <el-select v-model="bidReview.proManagers" filterable placeholder="请选择" disabled>
                                        <el-option v-for="item in personnel" :key="item.id" :label="item.staffName"
                                                   :value="item.id"></el-option>
                                    </el-select>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <div class="unit">
                            <div class="unit_center">
                                <el-table :data="businessDetails" style="width: 100%" border>
                                    <el-table-column prop="unit" label="投标报价项" align="center">
                                        <template slot-scope="scope">
                                            <el-input v-model="scope.row.tenderOfferItem" disabled></el-input>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="effect" label="控制价" align="center">
                                        <template slot-scope="scope">
                                            <el-input v-model="scope.row.controlPrice" type="number" min="0" disabled></el-input>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="type" label="我司报价" align="center">
                                        <template slot-scope="scope">
                                            <el-input v-model="scope.row.ourQuotation" type="number" min="0" disabled></el-input>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="type" label="得分" align="center">
                                        <template slot-scope="scope">
                                            <el-input v-model="scope.row.score" type="number" min="0" disabled></el-input>
                                        </template>
                                    </el-table-column>
                                </el-table>
                            </div>
                        </div>
                        <%--经济分析--%>
                        <div class="title">
                            <h3>经济分析</h3>
                        </div>
                        <el-row>
                            <x-col>
                                <el-form-item label="资本金要求" >
                                    <span>{{projectInfo.capitalFund}}</span>
                                </el-form-item>
                            </x-col>
                            <x-col position="right">
                                <el-form-item label="股权比例" >
                                    <span>{{projectInfo.stockPercent}}</span>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <el-row>
                            <x-col>
                                <el-form-item label="建安下浮率" >
                                    <span>{{projectInfo.jianAnDownRate}}</span>
                                </el-form-item>
                            </x-col>
                            <x-col position="right">
                                <el-form-item label="合理利润率" >
                                    <span>{{projectInfo.profitRate}}</span>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <el-row>
                            <x-col>
                                <el-form-item label="综合回报率" >
                                    <span>{{projectInfo.compreRate}}</span>
                                </el-form-item>
                            </x-col>
                            <x-col position="right">
                                <el-form-item label="年度折现率" >
                                    <span>{{projectInfo.yearDiscountRate}}</span>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <el-row>
                            <x-col>
                                <el-form-item label="建筑施工利润率" >
                                    <span>{{projectInfo.buildConstrRate}}</span>
                                </el-form-item>
                            </x-col>
                            <x-col position="right">
                                <el-form-item label="投资利润率" >
                                    <span>{{projectInfo.investBackRate}}</span>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <el-row>
                            <x-col>
                                <el-form-item label="运营利润" >
                                    <span>{{projectInfo.operatProfit}}</span>
                                </el-form-item>
                            </x-col>
                            <x-col position="right">
                                <el-form-item label="综合利润" >
                                    <span>{{projectInfo.comperProfit}}</span>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <%--项目附件信息--%>
                        <div class="title">
                            <h3>项目附件信息</h3>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label" style="width:350px;">支持pdf、excel、word、图片资料，可上传多个</label>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">商务投标文件</label>
                            <div class="layui-input-block">
                                <div class="layui-upload">
                                    <div class="layui-upload-list" id="25-upload-more-list">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </el-form>
                </div>
            </div>
            <div class="layui-tab-item">
                <%@ include file="lay-processHistory-detail.jsp" %>
            </div>
        </div>
    </div>
</div>
<script src="${ctx}/resources/vue-element-lib/jquery.js"></script>
<script>
    let fileArr = [];
    var staticPath = '${fileHttpPre}';
    layui.config({
        base: '${ctx}/resources/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'set', 'upload', 'table', 'transfer', 'laydate', 'element', 'layer'], function () {
        var $ = layui.$
            , upload = layui.upload
            , table = layui.table
            , element = layui.element
            , layer = layui.layer;
    });

    //删除文件
    function del(index) {
        layui.$("#fileAtt_" + index).remove();
        layui.$("#upload_img_" + index).remove();
        fileArr.map((el, idx) => {
            if (el.split('|')[2] == index) {
                fileArr.splice(idx, 1)
            }
        })
    }

    //根据url查看文件
    function showImg(url) {
        var openWin = window.open(url, '', 'left=410,height=768, width=1024, top=200,  toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
    }

    /*核心*/
    var vm = new Vue({
        el: '#app',
        data() {
            return {
                layId: '0',
                procNodeList: [],
                tempNodeList: [],
                auditMsg: '',//审批意见
                projectInfo: {},
                bidReview: '',
                personnel: [],
                proCode: '',
                businessDetails: [],
                id: '',
            }
        },
        created() {
            this.proCode = "${proCode}"
            this.id = "${id}"
            this.processId = "${processId}";
            this.queryPersonnel();
            this.queryProcessList();
        },
        mounted() {

        },
        methods: {
            queryProcessList() {
                let that = this;
                $.ajax({
                    type: 'post',
                    url: basePath + '/historyProcess/proNodeDetail',  //请求数据接口
                    data: {processId: that.processId},
                    success: function (result) {
                        if (result.entity) {
                            that.procNodeList = result.entity.procNodeList;
                            that.tempNodeList = result.entity.tempNodeList;
                            that.projectInfo = result.entity.detailJson.projectInfo;
                            that.bidReview = result.entity.detailJson.bidReview;
                            that.businessDetails = result.entity.detailJson.businessDetails;
                            let arr = [];
                            if (that.bidInfo.bidHead) {
                                arr.push(that.bidInfo.bidHead)
                            }
                            if (result.entity.detailJson.businessDetails) {//商务标
                                result.entity.detailJson.businessDetails.bidName = '商务标';
                                result.entity.detailJson.businessDetails.commerceCooperateSguids = that.strFn(result.entity.detailJson.businessDetails.commerceCooperateSguids)
                                that.memberArr.push(result.businessDetails)
                                if (result.entity.detailJson.businessDetails.commercePeopleSguid) {
                                    arr.push(result.entity.detailJson.businessDetails.commercePeopleSguid)
                                }
                                if (result.entity.detailJson.businessDetails.commerceCooperateSguids && result.entity.detailJson.businessDetails.commerceCooperateSguids.length > 0) {
                                    let businessDetailsArr = result.entity.detailJson.businessDetails.commerceCooperateSguids
                                    businessDetailsArr.map(el => {
                                        arr.push(el)
                                    })
                                }
                            }
                            if (result.entity.detailJson.creditDetail) {//资信标
                                result.entity.detailJson.creditDetail.bidName = '资信标';
                                result.entity.detailJson.creditDetail.commerceCooperateSguids = that.strFn(result.entity.detailJson.creditDetail.commerceCooperateSguids)
                                that.memberArr.push(result.creditDetail)
                                if (result.creditDetail.commercePeopleSguid) {
                                    arr.push(result.creditDetail.commercePeopleSguid)
                                }
                                if (result.entity.detailJson.creditDetail.commerceCooperateSguids && result.entity.detailJson.creditDetail.commerceCooperateSguids.length > 0) {
                                    let creditDetailArr = result.entity.detailJson.creditDetail.commerceCooperateSguids
                                    creditDetailArr.map(el => {
                                        arr.push(el)
                                    })
                                }
                            }
                            if (result.entity.detailJson.technicalDetail) {//技术标
                                result.entity.detailJson.technicalDetail.bidName = '技术标'
                                result.entity.detailJson.technicalDetail.commerceCooperateSguids = that.strFn(result.entity.detailJson.technicalDetail.commerceCooperateSguids)
                                that.memberArr.push(result.entity.detailJson.technicalDetail);
                                if (result.entity.detailJson.technicalDetail.commercePeopleSguid) {
                                    arr.push(result.entity.detailJson.technicalDetail.commercePeopleSguid)
                                }
                                if (result.entity.detailJson.technicalDetail.commerceCooperateSguids && result.entity.detailJson.technicalDetail.commerceCooperateSguids.length > 0) {
                                    // arr.concat(result.technicalDetail.commerceCooperateSguids)
                                    let technicalDetailArr = result.entity.detailJson.technicalDetail.commerceCooperateSguids;
                                    technicalDetailArr.map(el => {
                                        arr.push(el)
                                    })
                                }
                            }
                            if (fileArr.length == 0) {
                                that.showFile(result.entity.detailJson.fileAtt);
                            }
                        }
                    }
                });
            },
            strFn(str) {
                str = str + ',';
                let arr = str.split(',');
                let arr1 = [];
                arr.map(el => {
                    if (el && el != 'null') {
                        arr1.push(el)
                    }
                })
                return arr1
            },
            showFile(fileList) {
                if (fileList && fileList.length > 0) {
                    fileArr = fileList;
                    for (let i in fileList) {
                        let contractInfo = fileList[i];
                        let arr = contractInfo.split("|");
                        let imgSrc = "";
                        let suffix = arr[1].substring(arr[1].lastIndexOf(".") + 1, arr[1].length);
                        if (suffix == 'jpg' || suffix == 'png') {
                            imgSrc = "${fileHttpPre}/" + arr[3];
                        } else {
                            imgSrc = "${ctx}/resources/images/" + suffix + ".jpg";
                        }
                        $('#' + arr[0] + '-upload-more-list')
                            .append('<div class="layui-upload-img-div" id="upload_img_' + arr[2] + '"><img src="' + imgSrc + '" title="'
                                + arr[1] + '" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\'' + "${fileHttpPre}"
                                + arr[3] + '\');">查看</a><a href="javascript:void(0)" onclick="del(\''
                                + arr[2] + '\')";>删除</a></div><p>' + arr[1] + '</p><input type="hidden" value="'
                                + contractInfo + '" id="fileAtt_' + arr[2] + '" name="fileAtts" ></input></div> ');
                    }
                }
            },
            //获取所有人
            queryPersonnel() {
                let that = this;
                $.ajax({
                    type: 'post',
                    url: basePath + '/proSell/queryPersonnel',  //请求数据接口
                    data: {},
                    success: function (result) {
                        that.personnel = result;
                    }
                });
            },
        }
    })
</script>
</body>
</html>

